<template>
    <div>
        <div>
            <h3> 查看shemas</h3>
            <div style="display: flex;;">
                <el-input v-model.trim="queryParams.name" size="mini" style="width: 220px;;"
                     placeholder="模糊"
                          @keydown.enter.native.prevent="()=>getInfoList()"
                ></el-input>
              <el-input v-model.trim="queryParams.name2" size="mini" style="width: 220px;;"
                        placeholder="精确搜索"
                        @keydown.enter.native.prevent="()=>getInfoList()"
              ></el-input>
                <el-button @click="() => getInfoList()" size="mini">查询 schemas</el-button>
            </div>

            <el-table :data="dataList" size="mini">
                <el-table-column label="name">
                    <template slot-scope="scope">
                        <span>{{ scope.row.name }}</span>
                    </template>

                </el-table-column>
                <el-table-column label="jsoncontent">
                    <template slot-scope="scope">
                        <el-scrollbar style="height: 100px;">
                            <div v-html="scope.row.jsoncontent"></div>
                        </el-scrollbar>
                    </template>

                </el-table-column>

            </el-table>

            <el-pagination style="margin: 5px 0px;" :page-size="queryParams.pageSize"
                :current-page.sync="queryParams.pageNum" layout="prev, pager, next" :total="total"
                @size-change="(pageSize) => { $data.queryParams.pageSize = pageSize; dataList = []; getInfoList(); }"
                @current-change="(pageNum) => { $data.queryParams.pageNum = pageNum; dataList = []; getInfoList(); }">
            </el-pagination>
        </div>
    </div>
</template>
<script>
import axios from 'axios'

export default {
    data() {
        return {
            total: 0,
            dataList: [],
            queryParams: {
              name2: '',
                projectCode: '',
                name: '',
                pageSize: 5,
            },
            apidosurl: '',
        }
    },
    methods: {
        initByDialog(_data){
                    this.queryParams.projectCode=_data?.projectCode;
            },
        async getInfoList() {
            var dataList_rs = await axios.post("/apis/swagger1/getshemas", { ...this.queryParams }).then(res => res.data)
            this.dataList = dataList_rs?.data || []
            this.total = dataList_rs?.total
        }
    }
}</script>
